<?php

class RSSFeed {

	function dom() {
		$xml = new DOMDocument( "1.0", "utf-8" );
		
		// rss
		$rss = $xml->createElement( "rss" );
		$xml->appendChild( $rss );
		
		$rss->setAttribute( "version", "2.0" );
		$rss->setAttribute( "xmlns:content", "http://purl.org/rss/1.0/modules/content/" );
		$rss->setAttribute( "xmlns:atom", "http://www.w3.org/2005/Atom" );
		
		// channel
		$channel = $xml->createElement( "channel" );
		$rss->appendChild( $channel );

		$channel->appendChild( $xml->createElement( "title", "test title" ) );
		$channel->appendChild( $xml->createElement( "link", "http://dev.ryantenney.com/rsstest.php" ) );
		$channel->appendChild( $xml->createElement( "description", "Give her a 10 for looks, and a 3 for her ability to describe herself." ) );

		$channel->appendChild( $xml->createElement( "lastBuildDate", "" ) );
		$channel->appendChild( $xml->createElement( "pubDate", "" ) );
		$channel->appendChild( $xml->createElement( "category", "" ) );
		$channel->appendChild( $xml->createElement( "managingEditor", "" ) );
		$channel->appendChild( $xml->createElement( "webMaster", "" ) );
		$channel->appendChild( $xml->createElement( "generator", "" ) );

		$channel->appendChild( $xml->createElement( "language", "" ) );
		$channel->appendChild( $xml->createElement( "copyright", "" ) );

		$image = $xml->createElement( "image" );
		$image->appendChild( $xml->createElement( "url", "" ) );
		$image->appendChild( $xml->createElement( "title", "" ) );
		$image->appendChild( $xml->createElement( "link", "" ) );
		$channel->appendChild( $image );
		
		$atom_link = $xml->createElement( "atom:link" );
		$atom_link->setAttribute( "href", $self );
		$atom_link->setAttribute( "rel", "self" );
		$atom_link->setAttribute( "type", "application/rss+xml" );
		$channel->appendChild( $atom_link );

		// feed items
		$item = $xml->createElement( "item" );
		$item->appendChild( $xml->createElement( "title", "" ) );
		$item->appendChild( $xml->createElement( "link", "" ) );
		$item->appendChild( $xml->createElement( "description", "" ) );
		$item->appendChild( $xml->createElement( "pubDate", "" ) );
		$item->appendChild( $xml->createElement( "source", "" ) );
		$item->appendChild( $xml->createElement( "category", "" ) );
		$item->appendChild( $xml->createElement( "comments", "" ) );
		$item->appendChild( $xml->createElement( "author", "" ) );
		$item->appendChild( $xml->createElement( "guid", "" ) );
		$channel->appendChild( $item );

		$xml->formatOutput = true;
		
		echo $xml->saveXML();
	}

}
